<?php

namespace app\admin\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        'username'  =>  'require|alphaDash',
        'password' =>  'require|alphaDash|min:8|max:16',
        'email' => 'require|email',
        'nickname' => 'require'
        ,'role' => 'require|number'
        ,'status' => 'number'
        ,'score' => 'number'
    ];
    protected $message = [
        'username.require' => '用户名不能为空'
        ,'password.require' => '密码不能为空'
        ,'email.require' => '邮箱不能为空'
        ,'nickname.require' => '昵称不能为空'
        ,'password.require' => '密码不能为空'
         ,'password.min' => '密码长度至少为8'
        ,'password.max' => '密码长度最大为16'
    ];
    protected $scene  = [
        'login' => ['username' , 'password']
        ,'register' => ['usernameReg' , 'passwordReg' , 'email' , 'nickname']
        ,'update' => ['username' , 'email' , 'nickname' , 'role', 'status' , 'score']
        ,'pwd' => ['password']
    ];
    
}